package test7;

import com.tyfspring.beans.config.BeanPostProcessor;
import com.tyfspring.beans.exception.BeansException;

/**
 * @Description TODO
 * @Author shallow
 * @Date 2023/4/10 19:52
 */

public class MyBeanPostProcessor implements BeanPostProcessor {
    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        if ("userService".equals(beanName)) {
            UserService userService = (UserService) bean;
            userService.setLocation("改为：北京");
        }
        return bean;

    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        return bean;
    }
}
